Skip to content

Use os.TempDir() for test socket path#1694

Merged
meiji163 merged 1 commit into
masterfrom
test-socket-path
May 29, 2026
Merged

Use os.TempDir() for test socket path#1694
meiji163 merged 1 commit into
masterfrom
test-socket-path

Conversation

@ericyan
Copy link
Copy Markdown
Contributor

@ericyan ericyan commented May 29, 2026

Description

This PR replaces runtime.Caller(0)-based socket path construction with os.TempDir() in newTestMigrationContext.

As the path is constructed relative to the source tree, in some CI environments the path might be too long, causing tests to fail due to the fact that Linux enforces a hard limit of 108 characters for Unix socket paths.

This also ensures that each test run no longer shares a hardcoded socket path, reducing the risk of failures if a previous test leaked the socket.

As an additional benefit, it drops the runtime import and the //nolint:dogsled suppression.

In case this PR introduced Go code changes:

  • contributed code is using same conventions as original code
  • script/cibuild returns with no formatting errors, build errors or unit test errors.

Refactor newTestMigrationContext to set ServeSocketFile via os.TempDir() and remove runtime.Caller-based path derivation.
@ericyan ericyan marked this pull request as ready for review May 29, 2026 16:29
@ericyan ericyan requested review from meiji163 and rashiq as code owners May 29, 2026 16:29
Copilot AI review requested due to automatic review settings May 29, 2026 16:29
@ericyan ericyan requested a review from timvaillancourt as a code owner May 29, 2026 16:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Replaces the runtime.Caller(0)-based source-relative socket path with os.TempDir() for the test migration context, avoiding the 108-char Unix socket path limit hit in some CI environments and removing the runtime import and //nolint:dogsled suppression.

Changes:

  • Switch ServeSocketFile construction to filepath.Join(os.TempDir(), "gh-ost.sock").
  • Drop the runtime import and the associated //nolint:dogsled directive.
Show a summary per file
File Description
go/logic/test_utils.go Builds test socket path under the system temp dir instead of relative to the source file.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@meiji163 meiji163 merged commit 251b08d into master May 29, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants